package com.k7.mobile.platform.util;

import java.net.URLDecoder;
import java.net.URLEncoder;

import org.apache.commons.lang.StringUtils;

public class GcUtil {
	public static String urlEncode(String word, String charset){
		if(StringUtils.isEmpty(word)){
			return null;
		}
		try{
			return URLEncoder.encode(word, charset);
		}catch(Exception ex){
			return word;
		}
	}
	
	public static String urlDecode(String word, String charset){
		if(StringUtils.isEmpty(word)){
			return null;
		}
		try{
			return URLDecoder.decode(word, charset);
		}catch(Exception ex){
			return word;
		}
	}
}
